/****
 * SWF加载进度显示 
 * @author yue
 * @ver 20140102
 */
function LoadProgress(par){
	
	//private
	var self = this;
	var itv = null;

	//public
	this.swf = null;

	//构造
	this.constructor = function(){

		if(window.ActiveXObject){
			var tempdiv = document.createElement("div");  
			var tempstr = "";
			 
			tempstr +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+par.width+'" height="'+par.height+'">';
			tempstr +='<param name="movie" value="'+par.movie+'">';
			tempstr +='<param name="quality" value="high">';
			tempstr +='<param name="wmode" value="transparent"> ';
			tempstr +='<param name="menu" value="false"> '; 
			
			tempstr +='</object>';
			 
		//	tempdiv.style.cssText="display:none;"
			tempdiv.innerHTML = tempstr;
			
			self.swf = tempdiv.removeChild(tempdiv.getElementsByTagName("object")[0]);
			div = null;
			
		}else{
			var embed = document.createElement("embed");
			embed.width = par.width;
			embed.height = par.height;
			embed.src = par.movie;
			embed.scale = "exactfit";
			embed.name = "mycamera";
			embed.quality = "high";
			embed.bgcolor = "#000000";
			embed.menu = "false";
			embed.swLiveConnect = "true";
			embed.allowScriptAccess = "always";
			embed.type = "application/x-shockwave-flash";
			
			self.swf = embed;
		}
		par.container.appendChild(self.swf);
		
	}();
	
	this.display = function(isDisplay){
		if(window.ActiveXObject){
			if(isDisplay){
				self.swf.style.display = "";
			}else{
				self.swf.style.display = "none";
			}
		}else{
			if(isDisplay){
				self.swf.height = par.height;
			}else{
				self.swf.height = 0;
			}
		}
	}
	
	this.refreshProgress = function(onProgress, onLoaded){

		var nPercentLoaded = Math.abs(self.swf.PercentLoaded());

		if(nPercentLoaded >= 100){
			window.clearInterval(itv);
			onLoaded();
		}else{
			onProgress(nPercentLoaded);
		}
	}
	
/****
 * @param1 加载进度百分比回调函数
 * @param2 加载完毕回调函数
 */
	this.progress = function(onProgress, onLoaded){
		itv = setInterval(function(){self.refreshProgress(onProgress, onLoaded);}, 100);
	};
}

/*
 * 使用方法
 
<body>
<div id="info" style="font-size:36px">0%</div>
<div id="swfdiv"></div>
<script language="javascript">

var slp = new LoadProgress({
	container : document.getElementById("swfdiv"),
	movie : "http://www.xhb17.com/data/flash/0000/0148/00000148.swf",
	width : "960",
	height : "640"
});

slp.progress(function(prog){
	document.getElementById("info").innerHTML = prog+"%";
}, function(){
	document.getElementById("info").innerHTML = "100%";
});

</script>
</body>

*/